package com.zb.config;

import org.springframework.beans.factory.InitializingBean;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;

import java.util.Objects;

/**
 * 读取配置文件配置工具类
 * @Author WEN
 * @Date 2023/7/27 0027
 **/
@Component
public class ProfileConfigUtil implements InitializingBean {
    /**
     * 是否为生产环境
     */
    public static boolean ENVIRONMENT_PROD;

    @Value("${spring.profiles.active}")
    private String environmentConfig;


    @Override
    public void afterPropertiesSet() throws Exception {
        ENVIRONMENT_PROD = Objects.equals("prod", this.environmentConfig);
    }
}
